#ifndef _ADC_DRV_H
#define _ADC_DRV_H

#include "r_cg_macrodriver.h"
#include "r_cg_adc.h"

#define S0  P4.3
#define S1  P4.2
#define S2  P4.1

#define GET_AD_VAL      0
#define UNTIL_CMPD      1

typedef enum
{
     SELECT_PORT0 = 0,
     SELECT_PORT1,
     SELECT_PORT2,
     SELECT_PORT3,
     SELECT_PORT4,
     SELECT_PORT5,
     SELECT_PORT6,
     SELECT_PORT7,
     SELECT_PORTN
}SelectPort_t;

typedef enum
{
    TEMP1 = 0,
    TEMP2,
    TEMP3,
    TEMP4,
    TEMP5,
    TEMP6,
    TEMP7,
    TEMP8,
    TEMP9,
    TEMP10,
    TEMP11,
    TEMP12,
    TEMP13,
    TEMP14,
    TEMP15,
    TEMP16,
    TEMP17,
    TEMP18,
    TEMP19,
    TEMP20,
    TEMP21,
    TEMP22,
    TEMP23,
    TEMP24,
    TEMP25,
    TEMP26,
    TEMP27,
    TEMP28,
    KEY1,
    KEY2,
    KEY3,
    KEY4,
    KEY5,
    KEY6,
    KEY7,
    KEY8,
    KEY9,
    KEY10,
    KEY11,
    KEY12,
    KEY13,
    KEY14,
    KEY15,
    KEY16,
    KEY17,
    KEY18,
    KEY19,
    KEY20,
    KEY21,
    SW1,
    SW2,

}HwName_t;

typedef enum
{
    K1 = 0,
}ADC_Key_t;

typedef struct
{
    HwName_t HwName;
    uint8_t SelectPort;
    ad_channel_t AdChannle;
}AdcSensor_t;

void AD_EventLoop(void);
void isConverted(uint16_t val);
typedef void (*AdEventCb_t)(HwName_t hName, uint16_t adValue);
void AdcDataEventCb(AdEventCb_t pFunc);

#endif